09bddb07ce44d415e2c8fa4cebe054504eb51fbb,src/main/java/applets/etsmtl/ca/news/jobs/strategy/FacebookNewsFetcher.java,FacebookNewsFetcher,fetchNouvelles,#,100
Before Change
String id = Jobjet_news.getString("id");
if (!this.nouvelleDao.isExisting(id)) {
String message = Jobjet_news.optString("message");
String link = Jobjet_news.optString("link");
String date = Jobjet_news.optString("created_time");
String name = Jobjet_news.optString("name");
if ((name == null) || ((name != null) && (name.isEmpty()))) {
name = message.substring(0, Math.min(15, message.length()));
}
String picture = Jobjet_news.optString("picture");
Nouvelle nouvelle = new Nouvelle();
nouvelle.setId(id);
nouvelle.setTitre(name);
nouvelle.setMessage(message);
nouvelle.setLink(link);
nouvelle.setDate(parseDate(date));
nouvelle.setUrlPicture(picture);
nouvelle.setId_source(this.key);
this.nouvelleDao.add(nouvelle);
}
}
} catch (IOException e) {
After Change
nouvelle.setId_source(this.key);
if (this.nouvelleDao.isExisting(id)) {
this.nouvelleDao.update(nouvelle);
} else {
this.nouvelleDao.add(nouvelle);
}
}
}